
package Relationship.Complex.Creation;

/**
 * This GUI is a simple information dialog that will explain to users how to enter
 * regular expressions for relationship building.
 * @author Kyle
 */
public class ComplexRelationshipInfo extends javax.swing.JFrame {
    //<editor-fold defaultstate="collapsed" desc="Constructor">
    /** Creates new form ComplexRelationshipInfo */
    public ComplexRelationshipInfo(javax.swing.JFrame gui) {
        initComponents();
        this.setSize(500,400);
        setDialogLocation();
        caller = gui;
        setDialogLocation();
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods">
    /**put this dialog in the middle of eHOST's main window*/
    private void setDialogLocation()
    {
        //If null was passed into the constructor then just return
        if (caller == null)
        {
            return;
        }

        //If non null gui then center the gui in the Callers window.
        int parentX = caller.getX(), parentY = caller.getY();
        int parentWidth = caller.getWidth(), parentHeight = caller.getHeight();
        int width = this.getWidth(), height = this.getHeight();

        int x = parentX + (int) ((parentWidth - width) / 2);
        int y = parentY + (int) ((parentHeight - height) / 2);

        this.setLocation(x, y);
    }
    //</editor-fold>

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(400, 300));
        setResizable(false);

        jPanel1.setLayout(new java.awt.BorderLayout());

        jPanel2.setLayout(new java.awt.BorderLayout());

        jButton1.setText("OK");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel2.add(jButton1, java.awt.BorderLayout.CENTER);

        jPanel1.add(jPanel2, java.awt.BorderLayout.PAGE_END);

        jScrollPane1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 10, true));

        jTextArea1.setColumns(20);
        jTextArea1.setEditable(false);
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jTextArea1.setText("When defining the allowed classes for a complex relationship only markable classes and regular expressions are allowed.\n\t1)DO use only full classnames.\n\t2)DO put all markable names in parentheses. i.e. (Test) not Test\n\t3)DO NOT use regular expresions to combine two markable names.\n\ti.e. use (Problem1)|(Problem2) NOT (Problem(1|2))\n\nExamples:\n1)If you want to allow an infinite chain of 'Problem' markables enter: (Problem)*\n\t\n2)If you want to allow a chain of one 'Test' markable that revealed a 'Problem' markable that was treated with any number of 'Treatment' markables enter: (Test)(Problem)(Treatment)*\n\t\n3)If you want to allow a chain of one 'Test' that can either be linked to a 'Problem' or a 'Treatment' markable you would enter: (Test)((Problem)|(Treatment))");
        jTextArea1.setWrapStyleWord(true);
        jScrollPane1.setViewportView(jTextArea1);

        jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    //<editor-fold defaultstate="collapsed" desc="Events">
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton1ActionPerformed
    {//GEN-HEADEREND:event_jButton1ActionPerformed
        this.dispose();
    }//GEN-LAST:event_jButton1ActionPerformed
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Member Variables">
    private javax.swing.JFrame caller;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables
    //</editor-fold>
}
